package com.leehom.arch.base.redis.client;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @类名: CustomerConfig
 * @说明: 自定义序列化器配置
 *
 * @author   leehom
 * @Date	 2020年11月26日 下午4:49:57
 * 修改记录：
 *
 * @see 	 
 */
@Configuration
public class CustomerConfig {

	@Bean(name="keySer")
    public RedisSerializer<Object> keyRedisSerializer() {
    	Jackson2JsonRedisSerializer<Object> ser = new Jackson2JsonRedisSerializer<Object>(Object.class);
    	//
        ObjectMapper om = new ObjectMapper();
        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
        //
        ser.setObjectMapper(om);
    	return ser;
    }
}
